package adapters;

import org2.jogo.models.Leaderboard;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;

public class LeaderboardDbAdapter extends JogoOrgDbAdapter {

	private static LeaderboardDbAdapter	adapter;

	public static LeaderboardDbAdapter getDbAdapter(Context ctx) {
		if (adapter == null) {
			adapter = new LeaderboardDbAdapter(ctx);
			adapter.open();
		}
		return adapter;
	}

	private LeaderboardDbAdapter(Context ctx) {
		this.mCtx = ctx;
	}

	public long decoraPontuacao(ContentValues valores) {
		return mDb.insert(Leaderboard.getTableName(), null, valores);
	}

	public Cursor getBestPontuacoes(int dificuldade) {
		return mDb.query(Leaderboard.getTableName(), null, "dificuldade = " + dificuldade, null, null, null, "pontuacao desc, _id desc");
	}
}
